#include "directry.ch"
#include "Dbstruct.ch"
#include "dbedit.ch"
#include "inkey.ch"
local aStru := {}
local elem
REQUEST DBFCDX
RddSetDefault('DBFCDX')
*do scrolbar

altd()
? ?  netname()
 use arqdados exclusive new
 aStru := arqdados->(dbstruct())

? " astru"
 AEVAL (astru,{|aField| QOUT (aField[DBS_NAME],aField[DBS_TYPE],aField[DBS_LEN],aField[DBS_DEC])})

* elem := ASCAN(aStru,{"LAST_USER", "C",  3,0})               //SE NAO ENCONTRAR RETORNA 0
* IF elem <> 0    // se achar
*    RETURN .f.                                       //@VCARGO, REFERENCIA
* ELSE            // nao encontrou
*   aADD( aStru, {"LAST_USER", "C", 3, 0} )
*? " astru depois aadd()"

   use
   copy structure extended to astru
   create arqdados from aStru
? " depois do create arqdados from aStru"
 AEVAL (astru,{|aField| QOUT (aField[DBS_NAME],aField[DBS_TYPE],aField[DBS_LEN],aField[DBS_DEC])})
 AEVAL (arqdados,{|aField| QOUT (aField[DBS_NAME],aField[DBS_TYPE],aField[DBS_LEN],aField[DBS_DEC])})

 use astru exclusive new
? " arqdados"
 AEVAL (arqdados->(dbstruct()),{|aField| QOUT (aField[DBS_NAME],aField[DBS_TYPE],aField[DBS_LEN],aField[DBS_DEC])})

*dbcreate("arqdados",astru)
*AEVAL (arqdados->(dbstruct()),{|aField| QOUT (aField[DBS_NAME],aField[DBS_TYPE],aField[DBS_LEN],aField[DBS_DEC])})
*   RETURN .t.
* ENDIF

? alias()
   APPEND BLANK
   REPLACE Field_name WITH "LAST_USER",;
   Field_type WITH "C",;
   Field_len  WITH 3,;
   Field_dec  WITH 0

? " arqdados depois do append blank"
 AEVAL (arqdados->(dbstruct()),{|aField| QOUT (aField[DBS_NAME],aField[DBS_TYPE],aField[DBS_LEN],aField[DBS_DEC])})

close databases

*  ScrollBarNew( <nTopRow>, <nTopColumn>, <nBottomRow>,
*                <cColorString>, <nInitPosition> ) --> aScrollBar


*aScrollBar := ScrollBarNew(1,1,20,, 1) // --> aScrollBar

? alias()
*browse()
*return

/*
if  alias("US") = .f.
  ? "nao tem alias US"
else
  ? " Alias US encontrado"
end



 nResult  := dirchange("z:\")
 if nResult != 0
    ? "o computador ou diretorio nao existe..."
 else
    ? "consegui dirchange('z:\')"

  use lixo shared new
  if ! neterr()
    ? " o arquivo Lixo aberto com sucesso"
    close all
  else
    ? "nao conseguiu abrir arquivo"
  endif
  wait
    run ("cd z:\")
    ? netname()
    ? curdir()
 endif
*/
